Repository navigation
feat(spec): the Studio hook form offers a refusal's reasons and params - #33796
Conversation
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5oQHgtkqYPCqstiKir
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5oQHgtkqYPCqstiKir
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5oQHgtkqYPCqstiKir
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5oQHgtkqYPCqstiKir
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5oQHgtkqYPCqstiKir
…unts Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5oQHgtkqYPCqstiKir
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5oQHgtkqYPCqstiKir
📓 Docs Drift Check4 anchor(s) derived from 2 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 172 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin aa1398f0084696194a6b48193188dc58e894fb44 && git checkout aa1398f0084696194a6b48193188dc58e894fb44
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin b005638268828ffdef8819f04b141a13296e7de4 2e0174a80638baa46bfd1b70fd73b12c5b6d864c && git checkout -B drift-repro b005638268828ffdef8819f04b141a13296e7de4 && git merge --no-ff 2e0174a80638baa46bfd1b70fd73b12c5b6d864c
node scripts/docs-audit/affected-docs.mjs --json b005638268828ffdef8819f04b141a13296e7de4 |
|
domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD Contract reviewServed-tier: Inputs read: card #33657 (body and comments 6889955794, 6891882852, 6892138272, 6893270996, 6893283751), PR #33796 (body, 21 files, net diff of ① Derived judgments
② Semver level
Clause-②: yes (widening) is correct: the published ③ Boundary flags
④ Design judgment
What holds:
Findings:
One should-fix and two nits; no must-fix. Implemented-by: VERDICT: PASS |
…removed
Removing the last entry of a record row emitted `{}`, which the form kept.
An empty map and an absent key draw the same empty list but read apart: an
entry's `reasons: {}` refuses every thrown reason, an absent one ignores it;
a hook's `refusals: {}` refuses every thrown code, an absent one leaves the
throws as they were. An optional row now writes the key absent through the
form's clear convention; a required row keeps `{}`.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5oQHgtkqYPCqstiKir
|
domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD Contract-review-handoff: review#1 — CONTRACT_REVIEW_TIER unavailable (maintainer routing to review#1, 2026-11-15T12:28Z) · head d3ff3bd Routing: the maintainer's 「review#1 正在入座,你这个账户后续的契约复审找他」 (2026-11-15T11:16Z). Owed: the delta review of should-fix S1 from the at-tier record 6893396284 (PASS on |
|
review#1 · os-elon-musk · session_016WV4cy7hQ5MvQ83ByNZ8ZH Contract-review-claim: session_016WV4cy7hQ5MvQ83ByNZ8ZH · head d3ff3bd · 2026-11-15T12:29:36Z |
|
review#1 · os-elon-musk · session_016WV4cy7hQ5MvQ83ByNZ8ZH Contract reviewServed-tier: Delta review of S1 (record ID: 6893396284), taken on handoff 6894324874 under claim 6894340140. That record judged head Inputs read: PR #33796 (body, 22 files, comments 6893271437, 6893396284, 6894324874), card #33657, the diff What moved: one commit, ① Derived judgments
② Semver levelThe changeset gains one paragraph and changes no package or level: Clause-②: yes (widening) still holds: the delta touches no published spec file. ③ Boundary flags
④ Design judgment
S1: closed The two ui test files (implementing: the pins). The Studio pins cover add-then-remove, removing the last stored reason (with
No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD Contract-review-handoff: review#1 — CONTRACT_REVIEW_TIER unavailable (maintainer routing to review#1, 2026-11-15T12:35Z) · head 2e0174a Owed: carrying the delta PASS 6894383458 (on |
|
review#1 · os-elon-musk · session_016WV4cy7hQ5MvQ83ByNZ8ZH Contract-review-claim: session_016WV4cy7hQ5MvQ83ByNZ8ZH · head 2e0174a · 2026-11-15T12:38:27Z |
|
review#1 · os-elon-musk · session_016WV4cy7hQ5MvQ83ByNZ8ZH Contract reviewServed-tier: Merge-only delta record, taken on handoff 6894405815 under claim 6894437852. It carries the PASS of record 6894383458 (head Inputs read: PR #33796 (body, 22 files, comments up to 6894437852), card #33657, the merge commit, ① Derived judgments
② Semver levelUnchanged by the merge. The changeset is byte-identical to the one judged: ③ Boundary flags
④ Design judgment
The merge itself. The one shared file is generated, the two additions are independent keys, and the merged file is the union of the two. No design question arises from it. No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD 席位核对Verdict: ACCEPT · head
|
|
domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD Landing · head
State: ready + auto-merge. |
Requested by Leehom · project thread
Fixes #33657
Clause-②: yes (widening)
Metadata-protocol: none
Seat
domain:ui#1· os-project-manager · card threadsession_01FEkQ5oQHgtkqYPCqstiKir· claim 6892138272维护者速读
{{ 名称 }}可以填的名字)。表单定义hookForm加两行;渲染器本来就能画「嵌套在键值记录里的键值记录」和名称列表。契约复审 S1 之后另有一处渲染器修正:可选的键值记录行删掉最后一条时,现在写成「不存在」,不再写成空对象{}。refusals) cannot translate a handler-authored hook's refusals, and holds one sentence per code — a TS hook has no way to refuse in the user's language #33214 让拒绝目录支持reasons和params,但 Studio 表单只给了两项,作者在 Studio 里没法声明这两项能力。reasons/params的目录经 Studio 编辑其他字段后已经能原样保存,本改动后依旧如此;只填提示语和状态码的条目保存结果与今天逐字节相同。回滚即还原本 PR。reasons: {};空对象和不写读法不同(空对象会拒绝主体抛出的每个原因,不写则不读原因),而界面上两者看起来一样。同样的问题在上一层:删掉最后一个错误码会存下refusals: {},它会拒绝主体抛出的每个错误码。现在两处都写成「不存在」;必填的键值记录行(对象的fields)照旧保留{}。packages/spec/src/data/hook.form.ts(新增的两行)、ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.hookRefusalReasons-33657.test.tsx(经真实 Studio 编辑页填写、保存、读回)、packages/spec/src/system/metadata-form-zod-reconciliation.test.ts(删掉两条 omit 台账行)。refusals的钩子,点「编辑」,展开一条错误码:应看到 Key / Message / Status / Reasons / Params 五项;在 Reasons 里加plan_locked并填一句话,在 Params 里填state,保存后重新打开仍在。hook.form.ts随@objectstack/spec发布,席位先补契约复审记录)。What changes
packages/spec/src/data/hook.form.ts). Therefusalsrow's entry gains two sub-rows aftermessageandstatus:reasons:type: 'record',widget: 'key-only-record', with one sub-rowmessage(required textarea). A reason entry is{ message }and nothing else, with no member that echoes its key, so it takes the same key-only record control the catalogue itself takes. The key rule the control checks is the served schema's ownpropertyNames.patternforreasons, which the spec derives fromHOOK_REFUSAL_REASON_PATTERN; the form restates no rule.params:type: 'tags', the name list control.messagehelp text said the sentence is "plain text, with no placeholders". Onceparamsis on the same card that is false, so it now says a{{ name }}hole fills a declared param. The new rows' help texts reciteHookRefusalSchema's own.describe()text.packages/spec/src/system/metadata-form-zod-reconciliation.test.ts): the twoomitrows forhook/refusals/reasonsandparamsare gone.origin/mainbefore any edit (below): the console's generic form renderer (SchemaForm'sRecordField) already draws a key-only record nested inside a key-only record entry, reads each level's key rule from the schema it is handed (servedRecordKeyPattern), and draws atagsrow as the string-tags widget.ui/packages/app-shell/src/views/metadata-admin/SchemaForm.tsx, contract review S1, d3ff3bd).RecordField.removeItememitted{}once the last entry went, and nothing on the save path dropped it.RecordFieldnow takesFieldControl'sofferUnset(the key is optional and not a list element, the condition the enum select's "— None —" already uses) and, when that holds, emits an empty map asundefined, the form's clear convention. A required row keeps{}. See "S1: empty versus absent" below for the forms this reaches.@objectstack/platform-objects' metadata-form bundles (regenerated withnode scripts/check-i18n-bundles.mjs --write, then the new leaves translated by hand, the same ten therefusalsrow is translated in; a second--writedropped the source-hash entries of the translated leaves). The French label "Message" stays a byte copy of the source, as the existingrefusals.messagelabel already is. The console's zh-CN form labels (metadata-form-zh-cn.ts, read by the Pending changes sheet) name the three rows.@objectstack/platform-objectstranslation pins count the hook form's enumerated children and the row labels authored in the three hand-translated locales; the three new rows move them from 9 to 12 and from 738 to 741, each with a comment naming the rows..changeset/33657-hook-form-refusal-reasons-params.md:@objectstack/spec,@objectstack/platform-objects,@object-ui/app-shell,@object-ui/consolepatch (a widening withMetadata-protocol: none; app-shell is private and console'sdistships it).Measured first (on
origin/mainbd96ec9, before any edit)A probe through the real Studio edit page (
MetadataResourceEditPageforhook, the served formhookForm, the served schema fromHookSchema), over a stored hook whoserefusals.CONTRACT_LOCKEDdeclaresmessage,status: 409,params: ['state']andreasons.plan_locked.message:Key*,Message*,Status, nothing else. The deciding line is therefusalsrow'sfieldsarray inhook.form.ts, which listsmessageandstatusonly; the renderer draws exactly the sub-rows a record row lists (RecordFieldmaps itsspecs, the row'sfields).refusalsbyte-identical (paramsandreasonskept), and so did an edit of the entry's ownmessage. The deciding lines: the page sends the whole draft, andRecordField'supdateItemwrites{ ...entry, ...patch }, so members the form does not list are kept. So the card's "may lose them on a Studio edit" did not hold on main; the round-trip pin below now holds it.reasonsrecord and aparamstags row drewKey / Message / Status / Reasons / Params, showedplan_lockedas a nested entry, and no element id was duplicated. A nestedtype: 'record'sub-row goes through the sameFieldRow→resolveFieldFace→RecordFieldpath as a top-level one, with the sub-schema frompickSubSchema.S1: empty versus absent (contract review 6893396284)
Measured through the real Studio edit page on 2238c90, before the fix (each new pin below red, received shown):
plan_lockedtoCONTRACT_LOCKED, remove it, edit Label, Save: the entry was stored as{ message, reasons: {}, status: 409 };reasons: {},paramskept;refusals: {}.{}and absent read differently at both levels. Forreasons,hook.zod.ts's save-time check refuses every literal reason thrown under a code whosereasonsis{}, and the runtime catalogue faults a computed one; an absentreasonsdoes not read the thrown reason. Forrefusals,{}is a declared catalogue with no codes, so every code the body throws is refused (and a non-js body is refused outright); an absent catalogue leaves the throws as they were. The screen draws the same empty list either way.The generic
RecordFieldinline face is reached by exactly three form rows across the served forms (type: 'record'rows inpackages/spec/src/**/*.form.ts; no other form declares one, and the othertype: 'record'hits in the repo are pages):object→fieldsrequired: true{}{}(unchanged, no absent state)hook→refusals{}(refuses every thrown code)hook→refusals.<CODE>.reasons{}(refuses every thrown reason)So
{}and absent are not equivalent for the second row either, and the generic fix changes it in the same direction as the finding. That is why the fix is generic and gated on the row being optional, rather than local to the hook form: the form has no per-row way to say "empty means absent", and therefusalsrow has the same defect. Add-then-remove with no other edit now returns the draft to the stored hook, so the page has nothing to save.Tests
ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.hookRefusalReasons-33657.test.tsx(new, the real Studio form): the real page with the production registrations, the type row built the way the server builds it (hookForm+z.toJSONSchema(HookSchema, { io: 'input' })), a stub metadata client as the stored row.Key, Message, Status, Reasons, Params;plan_locked+ its message) and a param (state) through the rendered controls, Save: the PUT body's entry is{ message, status, reasons: { plan_locked: { message } }, params: ['state'] }andHookSchemaparses it; then a fresh page over the stored row shows the reason and its message and thestatechip;reasonsandparamsround-trips a Label edit: the body equals the stored hook with the new label;message+statussaves exactly as stored (keysmessage,status).{ message, status }, keys exactly those two;reasons(paramskept);reasonsholds the second, as before;refusalskey.ui/packages/app-shell/src/views/metadata-admin/SchemaForm.keyOnlyRecord-26835.test.tsx(the form definition test, newdescribe):hookFormdeclaresreasonsas a key-only record of{ message }andparamsastags; the served schema's reason key rule isHOOK_REFUSAL_REASON_PATTERN.source; author a reason + param and the value parses as written; a reason keyPLAN_LOCKEDis refused with the served rule and the value does not move; a stored catalogue reloads into the same rows. The file'saddKeyhelper now takes the lastKeybox: an open entry draws a second one for itsreasons, and the catalogue's own box comes after every card. The existing CONTROL there ("a hook authored with two refusals saves a body HookSchema accepts as written") passes unchanged in substance.SchemaForm.keyOnlyRecord-26835.test.tsx, S1describe: removing the last entry of the optionalrefusalsrow leaves norefusalskey andHookSchemaparses the value; CONTROL: the same row declaredrequired: truekeepsrefusals: {}.packages/spec/src/system/metadata-form-zod-reconciliation.test.ts: green without the twoomitrows (hook.refusalsoffers both keys).Ablations
Through
scripts/ablation-replace.mjs --deleteon the form source, each leg running the reconciliation test (specsrc), a spec rebuild,scripts/ablation-dist-preflight.mjs @objectstack/spec MARKER --absent(ui vitest reads spec fromdist), and both ui pin files (17 tests). Each restored with blob == HEAD andgit diff HEADempty; then spec rebuilt and the preflight run without--absentfound both markers back indist(exit 0), and both pin files were 17/17 green.reasonsrow deleted: reconciliation 1 failed / 75 (hook.refusals: accepted by the Zod but unauthorable in the form … expected [ 'reasons' ] to deeply equal []); ui 6 failed / 17 (the offer pin, the Studio author-save-reload pin, and all four SchemaFormreasons/paramspins).paramsrow deleted: reconciliation 1 failed / 75 (expected [ 'params' ]); ui 5 failed / 17 (the offer pin, both author pins, the definition pin and the reload pin).emitwrites the map as given): 4 failed / 23 across the two ui pin files (the SchemaForm optional-row pin and the three Studio S1 pins); the S1 CONTROLs stay green.offerUnsetgate dropped (every empty map written absent): 1 failed / 15 inSchemaForm.keyOnlyRecord-26835.test.tsx, the required-row CONTROL. Both restored by copying the fixed file back; 23/23 green.Acceptance notes
reasons/paramsalready kept them through a Studio edit (measured above). The new round-trip pin holds that, and nothing in this diff changes it.paramsis not checked in the form. The tags control accepts any text; a non-identifier is refused at save byHookSchema(A refusal param is an identifier (e.g. state)), and a{{ }}hole over an undeclared name is refused there too. The form restates no rule, as the order asks.hook.zod.ts, the runtime refusal catalogue, the lint rule, any server code.refusalsrow's help text still ends "JavaScript (L2) bodies only", while since feat(spec,runtime): hook refusals on handler hooks, with declared reasons and params #33641 ahandlerhook may declarerefusalstoo. The Studio form authors abodyhook (the handler row is the collapsed "Legacy handler" text field), so the sentence still describes what this form authors; left as is to keep this diff to the two rows. carrier: none.Verification
S1 round (head d3ff3bd)
dispatch-gates --commandsderives the same 88 families on d3ff3bd; all 88 exit 0, run sequentially after a full workspace build.--ran: 88 derived, 88 run, 0 NOT-MEASURED.ui/: the two pin files, 23 passed; the 15 metadata-admin test files that touch a record row,keyFieldorrefusals(grep -l "type: 'record'\|keyField\|refusals\|RecordField"), 179 passed. A run of the wholemetadata-admin/folder (281 files) did not finish inside a 25-minute timeout and was stopped; CI runs it.pnpm --filter @object-ui/app-shell run type-checkexit 0. ESLint--no-inline-configon the three changed ui files: exit 0, 17 warnings, none on a changed line.origin/mainis 28 commits past the branch;git merge-treeagainst it is clean.Local gates, suites, type-check and lint (head 2238c90)
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderives 88 families for this diff (tree 2238c90). All 88 exit 0 on 2238c90, run sequentially after a full workspace build (turbo run build, 119 tasks).--ranreconciliation: 88 derived, 88 run, 0 NOT-MEASURED, 0 UNRUN.check-plugin-teardown-shape --self-testexit 3 (shallow clone; exit 0 after fetching its fixture commit) andcheck:test-source-aliasexit 1 (the editedSchemaForm.keyOnlyRecord-26835.test.tsxreachesimport('@objectstack/lint')through the condition widget; module-top@objectstack/formula/@objectstack/lintimports added in 2238c90). The second round above is the one on the final head.node scripts/check-i18n-bundles.mjs --write --filter=platform-objectsregenerated the 21 drifted bundle files (eleven metadata-form bundles and ten source-hash tables); the new leaves were then translated by hand and a second--writedropped their source-hash entries.pnpm check:i18n,check:i18n-stale-fillandcheck:i18n-coverage(423 baselined, none new) exit 0.pnpm --filter @objectstack/spec test842 files, 26942 passed, 1 todo.pnpm --filter @objectstack/platform-objects test122 files, 1972 passed (first run: 3 failed, the hook form's enumerated-children census9and the zh-CN/ja-JP/es-ES row-label census738, which the three new rows move to12and741; updated in e764497 with their reason). Fromui/:SchemaForm.keyOnlyRecord-26835.test.tsx,ResourceEditPage.hookRefusalReasons-33657.test.tsxandmetadata-form-i18n.test.ts, 39 passed. The full app-shell suite and the rest of the farm are CI's.pnpm --filter @object-ui/app-shell run type-check,pnpm --filter @objectstack/spec typecheck,pnpm --filter @objectstack/platform-objects typecheck: exit 0. ESLint--no-inline-configon every changed source and test file: exit 0, one warning on an unchanged line of the existing harness (sink.value = next).pnpm check:new-line-citations(fromui/): 0 new, exit 0.origin/mainmoved 9 commits past base bd96ec9; none touches a file in this diff.🤖 Generated with Claude Code
https://claude.ai/code/session_01FEkQ5oQHgtkqYPCqstiKir
Generated by Claude Code